﻿using System;
using Glue;
using Xunit;

namespace GlueTests.AutoRelaterTests
{
    public class When_a_property_is_ignored_towards_right
    {
        private readonly Mapping<DomainPerson, GuiPerson> mapping;

        public class DomainPerson {public String Name{ get; set; }}
        public class GuiPerson { public String Name { get; set; } }

        public When_a_property_is_ignored_towards_right()
        {
            mapping = new Mapping<DomainPerson, GuiPerson>();
            mapping.IgnoreTowards<GuiPerson>(x => x.Name);
            mapping.AutoRelateEqualNames();
        }

        [Fact]
        public void Should_not_autorelate_towards_right()
        {
            Assert.Equal(0,mapping.Relations.GetRelationsTowardsRight().Count);
        }

        [Fact]
        public void Should_autorelate_towards_left()
        {
            Assert.Equal(1, mapping.Relations.GetRelationsTowardsLeft().Count);
        }
    }
}
